package com.github.kotvertolet.youtubejextractor.models.youtube.videoData;

import com.github.kotvertolet.youtubejextractor.models.youtube.playerResponse.UiActions;
import com.google.gson.annotations.SerializedName;
import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

import java.io.Serializable;


public class YoutubeVideoData implements Sequenceable, Serializable {

    @SerializedName("videoDetails")
    private VideoDetails videoDetails;
    @SerializedName("streamingData")
    private StreamingData streamingData;

    public static final Sequenceable.Producer<YoutubeVideoData> CREATOR = new Producer<YoutubeVideoData>() {
        @Override
        public YoutubeVideoData createFromParcel(Parcel parcel) {
            // Initialize an instance first, then do customized unmarshlling.
            YoutubeVideoData youtubeVideoData = new YoutubeVideoData();
            youtubeVideoData.unmarshalling(parcel);
            return youtubeVideoData;
        }
    };

    public YoutubeVideoData() {
    }


    public VideoDetails getVideoDetails() {
        return videoDetails;
    }

    public void setVideoDetails(VideoDetails videoDetails) {
        this.videoDetails = videoDetails;
    }

    public StreamingData getStreamingData() {
        return streamingData;
    }

    public void setStreamingData(StreamingData streamingData) {
        this.streamingData = streamingData;
    }

    @Override
    public String toString() {
        return "YoutubeVideoData{" +
                "videoDetails=" + videoDetails +
                ", streamingData=" + streamingData +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof YoutubeVideoData)) return false;

        YoutubeVideoData that = (YoutubeVideoData) o;

        if (!videoDetails.equals(that.videoDetails)) return false;
        return streamingData.equals(that.streamingData);
    }

    @Override
    public int hashCode() {
        int result = videoDetails.hashCode();
        result = 31 * result + streamingData.hashCode();
        return result;
    }



    @Override
    public boolean marshalling(Parcel parcel) {
        parcel.writeSequenceable(this.videoDetails);
        parcel.writeSequenceable(this.streamingData);
        return true;
    }

    @Override
    public boolean unmarshalling(Parcel parcel) {
        parcel.readSequenceable(this.videoDetails);
        parcel.readSequenceable(this.streamingData);
        return true;
    }
}